//
//  QMySelfInformationCell.m
//  QoilPublic
//
//  Created by 杨凯 on 16/7/5.
//  Copyright © 2016年 杨凯. All rights reserved.
//

#import "QMySelfInformationCell.h"

@interface QMySelfInformationCell()

@property (weak, nonatomic) IBOutlet UILabel *titleLabel;

@property (weak, nonatomic) IBOutlet UILabel *subTitleLabel;

@end
@implementation QMySelfInformationCell

- (void)awakeFromNib {
    [super awakeFromNib];
    [self setSeparatorInset:UIEdgeInsetsZero];
    [self setLayoutMargins:UIEdgeInsetsZero];
    self.headImageView.layer.cornerRadius = 25;
    self.headImageView.clipsToBounds = YES;
}

- (void)setIndexPath:(NSIndexPath *)indexPath{
    _indexPath = indexPath;
    if(indexPath.section == 0 && indexPath.row == 0){
        _titleLabel.text = @"头像";
        _headImageView.hidden = NO;
        _subTitleLabel.hidden = YES;
        self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }else if (indexPath.section == 0 && indexPath.row == 1){
        _titleLabel.text = @"昵称";
        _headImageView.hidden = YES;
        _subTitleLabel.hidden = NO;
        self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }else if (indexPath.section == 1){
        _titleLabel.text = @"手机";
        _headImageView.hidden = YES;
        _subTitleLabel.hidden = NO;
        self.accessoryType = UITableViewCellAccessoryNone;
    }else{
        _titleLabel.text = @"修改密码";
        _headImageView.hidden = YES;
        _subTitleLabel.hidden = YES;
        self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }
    
    if(_indexPath.section == 0 && _indexPath.row == 0){
        if([QUserInfo sharedInfo].loginModel.headImg.length > 0){
            [_headImageView sd_setImageWithURL:[NSURL URLWithString:[QUserInfo sharedInfo].loginModel.headImg] placeholderImage:[UIImage imageNamed:@"head_icon"]];
        }else{
            _headImageView.image = [UIImage imageNamed:@"head_icon"];
        }
    }else if (_indexPath.section == 0 && _indexPath.row == 1){
        _subTitleLabel.text = [QUserInfo sharedInfo].loginModel.nickName;
    }else if (_indexPath.section == 1){
        _subTitleLabel.text = [QUserInfo sharedInfo].loginModel.tel;
    }
}

@end
